<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.0">


  <link rel="icon" type="image/png" sizes="16x16" href="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/avatar.jpg">

<link rel="stylesheet" href="/next/css/main.css">



<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.3/css/all.min.css" integrity="sha256-2H3fkXt6FEmrReK448mDVGKb3WW2ZZw35gI7vqHOE4Y=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" integrity="sha256-Vzbj7sDDS/woiFS3uNKo8eIuni59rjyNGtXfstRzStA=" crossorigin="anonymous">

<script class="next-config" data-name="main" type="application/json">{"hostname":"cnhuazhu.gitee.io","root":"/next/","images":"/next/images","scheme":"Mist","version":"8.6.1","exturl":false,"sidebar":{"position":"left","Muse | Mist":320,"display":"post","padding":18,"offset":12},"copycode":true,"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":true,"mediumzoom":true,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/next/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}}</script><script src="/next/js/config.js"></script>
<meta name="description" content="介绍Jupyter Notebook的一些使用技巧">
<meta property="og:type" content="article">
<meta property="og:title" content="Jupyter Notebook使用技巧">
<meta property="og:url" content="https://cnhuazhu.gitee.io/next/2021/02/08/Jupyter%20Notebook/Jupyter%20Notebook%E4%BD%BF%E7%94%A8%E6%8A%80%E5%B7%A7/index.html">
<meta property="og:site_name" content="花猪のBlog">
<meta property="og:description" content="介绍Jupyter Notebook的一些使用技巧">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/%E6%9F%A5%E7%9C%8B%E5%AF%B9%E8%B1%A11.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/%E6%9F%A5%E7%9C%8B%E5%AF%B9%E8%B1%A12.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/shell%E5%91%BD%E4%BB%A4.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/%E8%BE%93%E5%87%BA1.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/%E8%BE%93%E5%87%BA2.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/%E8%BE%93%E5%87%BA3.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/%E6%89%A9%E5%B1%95%E6%8F%92%E4%BB%B6.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/xelatex.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/%E8%A7%A3%E5%86%B3%E4%B8%AD%E6%96%87%E6%98%BE%E7%A4%BA%E9%97%AE%E9%A2%98.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/%E5%AE%89%E8%A3%85%E4%BE%9D%E8%B5%96.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/%E7%94%9F%E6%88%90pdf.png">
<meta property="article:published_time" content="2021-02-08T03:31:23.000Z">
<meta property="article:modified_time" content="2021-02-19T13:43:53.965Z">
<meta property="article:author" content="花猪">
<meta property="article:tag" content="Jupyter">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/%E6%9F%A5%E7%9C%8B%E5%AF%B9%E8%B1%A11.png">


<link rel="canonical" href="https://cnhuazhu.gitee.io/next/2021/02/08/Jupyter%20Notebook/Jupyter%20Notebook%E4%BD%BF%E7%94%A8%E6%8A%80%E5%B7%A7/">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"https://cnhuazhu.gitee.io/next/2021/02/08/Jupyter%20Notebook/Jupyter%20Notebook%E4%BD%BF%E7%94%A8%E6%8A%80%E5%B7%A7/","path":"2021/02/08/Jupyter Notebook/Jupyter Notebook使用技巧/","title":"Jupyter Notebook使用技巧"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>Jupyter Notebook使用技巧 | 花猪のBlog</title>
  




  <noscript>
    <link rel="stylesheet" href="/next/css/noscript.css">
  </noscript>
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/next/" class="brand" rel="start">
      <i class="logo-line"></i>
      <h1 class="site-title">花猪のBlog</h1>
      <i class="logo-line"></i>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu">
        <li class="menu-item menu-item-主站"><a href="https://cnhuazhu.top/" rel="noopener" target="_blank"><i class="fas fa-chevron-right fa-fw"></i>主站</a></li>
        <li class="menu-item menu-item-home"><a href="/next/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li>
        <li class="menu-item menu-item-tags"><a href="/next/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签<span class="badge">14</span></a></li>
        <li class="menu-item menu-item-categories"><a href="/next/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类<span class="badge">8</span></a></li>
        <li class="menu-item menu-item-archives"><a href="/next/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档<span class="badge">53</span></a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</div>
        
  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%89%8D%E8%A8%80"><span class="nav-number">1.</span> <span class="nav-text">前言</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E7%9B%B8%E5%85%B3%E6%8A%80%E5%B7%A7"><span class="nav-number">2.</span> <span class="nav-text">相关技巧</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%BD%BF%E7%94%A8%E9%97%AE%E5%8F%B7%E6%9F%A5%E7%9C%8B%E5%AF%B9%E8%B1%A1%E7%9A%84%E7%9B%B8%E5%85%B3%E4%BF%A1%E6%81%AF"><span class="nav-number">2.1.</span> <span class="nav-text">使用问号查看对象的相关信息</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%BD%BF%E7%94%A8%E5%8F%B9%E5%8F%B7%E6%89%A7%E8%A1%8CShell%E5%91%BD%E4%BB%A4"><span class="nav-number">2.2.</span> <span class="nav-text">使用叹号执行Shell命令</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%85%B3%E4%BA%8E%E8%BE%93%E5%87%BA"><span class="nav-number">2.3.</span> <span class="nav-text">关于输出</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E8%B7%A8%E5%8D%95%E5%85%83%E6%A0%BC%E7%BC%96%E7%A0%81"><span class="nav-number">2.4.</span> <span class="nav-text">跨单元格编码</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%94%AF%E6%8C%81Markdown%E8%AF%AD%E6%B3%95"><span class="nav-number">2.5.</span> <span class="nav-text">支持Markdown语法</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%BF%AB%E6%8D%B7%E9%94%AE"><span class="nav-number">2.6.</span> <span class="nav-text">快捷键</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%89%A9%E5%B1%95%E6%8F%92%E4%BB%B6%E9%9B%86nbextensions"><span class="nav-number">2.7.</span> <span class="nav-text">扩展插件集nbextensions</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%AF%BC%E5%87%BA%E4%B8%BApdf%E6%96%87%E4%BB%B6"><span class="nav-number">2.8.</span> <span class="nav-text">导出为pdf文件</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E7%BB%93%E8%AF%AD"><span class="nav-number">3.</span> <span class="nav-text">结语</span></a></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-overview">
            <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="花猪"
      src="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/avatar.jpg">
  <p class="site-author-name" itemprop="name">花猪</p>
  <div class="site-description" itemprop="description">为了获得不同的阅读体验，建立此分站。<br>（可在导航栏搜索想要查看的文章）<br><br>本站主题：NEXT 8.6.1</div>
</div>
<div class="site-state-wrap site-overview-item animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/next/archives/">
        
          <span class="site-state-item-count">53</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/next/categories/">
          
        <span class="site-state-item-count">8</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/next/tags/">
          
        <span class="site-state-item-count">14</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author site-overview-item animated">
      <span class="links-of-author-item">
        <a href="https://github.com/CNhuazhu" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;CNhuazhu" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
  </div>



          </div>
        </div>
      </div>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>

  <a href="https://github.com/CNhuazhu" class="github-corner" title="Follow me on GitHub" aria-label="Follow me on GitHub" rel="noopener" target="_blank"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://cnhuazhu.gitee.io/next/2021/02/08/Jupyter%20Notebook/Jupyter%20Notebook%E4%BD%BF%E7%94%A8%E6%8A%80%E5%B7%A7/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/avatar.jpg">
      <meta itemprop="name" content="花猪">
      <meta itemprop="description" content="为了获得不同的阅读体验，建立此分站。<br>（可在导航栏搜索想要查看的文章）<br><br>本站主题：NEXT 8.6.1">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="花猪のBlog">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          Jupyter Notebook使用技巧
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2021-02-08 11:31:23" itemprop="dateCreated datePublished" datetime="2021-02-08T11:31:23+08:00">2021-02-08</time>
    </span>
      <span class="post-meta-item">
        <span class="post-meta-item-icon">
          <i class="far fa-calendar-check"></i>
        </span>
        <span class="post-meta-item-text">更新于</span>
        <time title="修改时间：2021-02-19 21:43:53" itemprop="dateModified" datetime="2021-02-19T21:43:53+08:00">2021-02-19</time>
      </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/next/categories/Python/" itemprop="url" rel="index"><span itemprop="name">Python</span></a>
        </span>
    </span>

  
    <span id="/next/2021/02/08/Jupyter%20Notebook/Jupyter%20Notebook%E4%BD%BF%E7%94%A8%E6%8A%80%E5%B7%A7/" class="post-meta-item leancloud_visitors" data-flag-title="Jupyter Notebook使用技巧" title="阅读次数">
      <span class="post-meta-item-icon">
        <i class="far fa-eye"></i>
      </span>
      <span class="post-meta-item-text">阅读次数：</span>
      <span class="leancloud-visitors-count"></span>
    </span>
    <span id="/next/2021/02/08/Jupyter%20Notebook/Jupyter%20Notebook%E4%BD%BF%E7%94%A8%E6%8A%80%E5%B7%A7/" class="post-meta-item twikoo_visitors" data-flag-title="Jupyter Notebook使用技巧" title="阅读次数">
      <span class="post-meta-item-icon">
        <i class="far fa-eye"></i>
      </span>
      <span class="post-meta-item-text">阅读次数：</span>
      <span id="twikoo_visitors"></span>
    </span>
  
      </div>
      <div class="post-meta">
    <span class="post-meta-item" title="本文字数">
      <span class="post-meta-item-icon">
        <i class="far fa-file-word"></i>
      </span>
      <span class="post-meta-item-text">本文字数：</span>
      <span>4.8k</span>
    </span>
    <span class="post-meta-item" title="阅读时长">
      <span class="post-meta-item-icon">
        <i class="far fa-clock"></i>
      </span>
      <span class="post-meta-item-text">阅读时长 &asymp;</span>
      <span>4 分钟</span>
    </span>
</div>

            <div class="post-description">介绍Jupyter Notebook的一些使用技巧</div>
        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <h1 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h1><p>为了更加方便快捷的使用<code>Jupyter Notebook</code>，本文将会介绍一些相关的使用技巧。</p>
<hr>
<h1 id="相关技巧"><a href="#相关技巧" class="headerlink" title="相关技巧"></a>相关技巧</h1><h2 id="使用问号查看对象的相关信息"><a href="#使用问号查看对象的相关信息" class="headerlink" title="使用问号查看对象的相关信息"></a>使用问号查看对象的相关信息</h2><p>对于代码中的所有对象，包括：变量、函数、方法、模块、等等，可以在某个对象的<strong>前面</strong>或<strong>后面</strong>添加<strong>一个</strong><code>?</code>，以查看该对象的相关信息。</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">aaa</span>():</span></span><br><span class="line">	<span class="built_in">print</span>(<span class="string">&#x27;Hello World&#x27;</span>)</span><br></pre></td></tr></table></figure>

<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">?aaa</span><br></pre></td></tr></table></figure>

<p>效果如下图：</p>
<p><img src="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/%E6%9F%A5%E7%9C%8B%E5%AF%B9%E8%B1%A11.png"></p>
<p>对于我们<code>自定义</code>的函数，可以在函数名的<strong>前面</strong>或<strong>后面</strong>添加<strong>两个</strong><code>?</code>，这样，在显示出来的相关信息中会包含函数的<code>源代码</code>。</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">aaa</span>():</span></span><br><span class="line">	<span class="built_in">print</span>(<span class="string">&#x27;Hello World&#x27;</span>)</span><br></pre></td></tr></table></figure>

<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">aaa??</span><br></pre></td></tr></table></figure>

<p>效果如下图：</p>
<p><img src="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/%E6%9F%A5%E7%9C%8B%E5%AF%B9%E8%B1%A12.png"></p>
<h2 id="使用叹号执行Shell命令"><a href="#使用叹号执行Shell命令" class="headerlink" title="使用叹号执行Shell命令"></a>使用叹号执行Shell命令</h2><p>在使用Jupyter Notebook编写代码时，只需要在Shell命令前添加一个<code>!</code>，就可以在notebook中执行<code>Shell命令</code>，完全不用来回切换。</p>
<p>举例：查看当前本机网络状态：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">!ipconfig</span><br></pre></td></tr></table></figure>

<p>效果如下图：</p>
<p><img src="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/shell%E5%91%BD%E4%BB%A4.png"></p>
<p>除了执行Shell命令之外，还可以将执行结果赋值给Python变量：</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">a = !ipconfig</span><br><span class="line"><span class="built_in">print</span>(a)</span><br><span class="line"><span class="built_in">print</span>(<span class="built_in">type</span>(a))</span><br></pre></td></tr></table></figure>

<h2 id="关于输出"><a href="#关于输出" class="headerlink" title="关于输出"></a>关于输出</h2><p>在notebook中运行单元格中的代码时，在默认情况下，单元格中<strong>最后一行</strong>的值会被自动输出：</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">aaa</span>():</span></span><br><span class="line">	<span class="built_in">print</span>(<span class="string">&#x27;Hello World&#x27;</span>)</span><br><span class="line"><span class="number">18</span></span><br></pre></td></tr></table></figure>

<p>输出效果如下图：</p>
<p><img src="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/%E8%BE%93%E5%87%BA1.png"></p>
<p>如果不想自动输出单元格中最后一行的值，可以在最后一行的行尾添加一个分号<code>;</code></p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">aaa</span>():</span></span><br><span class="line">	<span class="built_in">print</span>(<span class="string">&#x27;Hello World&#x27;</span>)</span><br><span class="line"><span class="number">18</span>;</span><br></pre></td></tr></table></figure>

<p>输出效果如下图：</p>
<p><img src="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/%E8%BE%93%E5%87%BA2.png"></p>
<p>在<strong>当前</strong>notebook中，如果希望单元格中<strong>每一行</strong>的值都被自动输出,可添加以下代码：</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> IPython.core.interactiveshell <span class="keyword">import</span> InteractiveShell</span><br><span class="line">InteractiveShell.ast_node_interactivity = <span class="string">&#x27;all&#x27;</span></span><br></pre></td></tr></table></figure>

<p>输出效果如下图：</p>
<p><img src="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/%E8%BE%93%E5%87%BA3.png"></p>
<p>如果希望在<strong>所有</strong>的notebook中都自动输出单元格中<strong>每一行</strong>的值，可以修改或创建<code>ipython_config.py</code>配置文件。</p>
<p>文件路径：</p>
<ul>
<li>Windows：C:\Users\用户名.ipython/profile_default/ipython_config.py</li>
<li>MacOS：/Users/用户名/.ipython/profile_default/ipython_config.py</li>
<li>Linux：/home/用户名/.ipython/profile_default/ipython_config.py</li>
</ul>
<p>打开配置文件添加以下代码：</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">c = get_config()</span><br><span class="line">c.InteractiveShell.ast_node_interactivity = <span class="string">&quot;all&quot;</span></span><br></pre></td></tr></table></figure>

<hr>
<h2 id="跨单元格编码"><a href="#跨单元格编码" class="headerlink" title="跨单元格编码"></a>跨单元格编码</h2><p>需要注意的是，在notebook中：</p>
<ul>
<li>前面运行的单元格会将相关变量保存到<strong>内存</strong>中，从而后面运行的单元格可以<strong>继续使用</strong>这些变量</li>
<li>关闭notebook的页面后，内存中保存的变量<strong>不会丢失</strong></li>
<li>如果当前notebook<code>Shutdown</code>或<code>Restart</code>了，那么内存中保存的所有变量都会<strong>丢失</strong></li>
</ul>
<p>建议：按照单元格<strong>从上到下</strong>的顺序编写代码并<strong>依次运行</strong>代码，否则，不仅可读性不好，而且容易出错。</p>
<hr>
<h2 id="支持Markdown语法"><a href="#支持Markdown语法" class="headerlink" title="支持Markdown语法"></a>支持Markdown语法</h2><p>Jupyter Notebook支持Markdown语法，在工具栏的下拉选项中将单元格调整为<code>Markdown</code>即可。</p>
<p>关于Markdown的相关介绍可以查看文章<code>《Markdown语法》</code></p>
<p>这里提醒一点，在插入图片时，可以直接点击菜单栏中的<code>Edit</code>，在打开的选项中点击<code>Insert Image</code>，这种操作方式<strong>优点</strong>是：将图片和notebook绑定在一起，在对notebook进行移动或其他操作时不用单独对图片进行处理；<strong>缺点</strong>是：notebook文件会变大，不能控制图片尺寸。</p>
<hr>
<h2 id="快捷键"><a href="#快捷键" class="headerlink" title="快捷键"></a>快捷键</h2><p>在notebook中有<strong>两种单元格</strong>，分别为：</p>
<ul>
<li>Code单元格：用来编写代码</li>
<li>Markdown单元格：用来将纯文本格式化为富文本</li>
</ul>
<p>每种单元格都有<strong>两种模式</strong>，分别为：</p>
<ul>
<li>编辑模式：按<code>Esc</code>键或者<code>点击单元格的外部</code>，都可以切换到命令模式</li>
<li>命令模式：按<code>Enter</code>键或者<code>点击单元格的内部</code>，都可以切换到编辑模式（对于运行之后的Markdown单元格，要<code>双击单元格的内部</code>，才能切换到编辑模式）</li>
</ul>
<p><strong>编辑模式</strong>下的快捷键：</p>
<table>
<thead>
<tr>
<th>快捷键</th>
<th>功能</th>
</tr>
</thead>
<tbody><tr>
<td>Tab</td>
<td>增加缩进（4个空格）、代码自动补全</td>
</tr>
<tr>
<td>Shift+Tab</td>
<td>减少缩进（4个空格）、查看对象的相关信息</td>
</tr>
<tr>
<td>Ctrl+A（Command+A）</td>
<td>全选</td>
</tr>
<tr>
<td>Ctrl+Z（Command+Z）</td>
<td>撤销</td>
</tr>
<tr>
<td>Ctrl+Y（Shift+Command+Z）</td>
<td>恢复</td>
</tr>
<tr>
<td>Ctrl+/（Command+/）</td>
<td>注释、取消注释</td>
</tr>
<tr>
<td>Ctrl+D（Command+D）</td>
<td>删除行</td>
</tr>
<tr>
<td>Ctrl+Home（Command+Home）</td>
<td>跳转到单元格的开始处</td>
</tr>
<tr>
<td>Ctrl+End（Command+End）</td>
<td>跳转到单元格的结尾处</td>
</tr>
<tr>
<td>Esc</td>
<td>退出编辑模式并进入命令模式</td>
</tr>
<tr>
<td>Ctrl+S（Command+S）</td>
<td>保存并更新记录点文件</td>
</tr>
<tr>
<td>↑</td>
<td>向上移动光标</td>
</tr>
<tr>
<td>↓</td>
<td>向下移动光标</td>
</tr>
<tr>
<td>Ctrl+Enter</td>
<td>运行当前单元格</td>
</tr>
<tr>
<td>Shift+Enter</td>
<td>运行当前单元格，并选中下方的单元格（如果下方没有单元格，则在下方自动插入一个单元格并选中）</td>
</tr>
<tr>
<td>Alt+Enter（Option+Enter）</td>
<td>运行当前单元格，在下方自动插入一个单元格并选中</td>
</tr>
</tbody></table>
<p><strong>命令模式</strong>下的快捷键：</p>
<table>
<thead>
<tr>
<th>快捷键</th>
<th>功能</th>
</tr>
</thead>
<tbody><tr>
<td>↑</td>
<td>选中上方的单元格</td>
</tr>
<tr>
<td>↓</td>
<td>选中下方的单元格</td>
</tr>
<tr>
<td>Shift+↑</td>
<td>扩展选中上方的单元格</td>
</tr>
<tr>
<td>Shift+↓</td>
<td>扩展选中下方的单元格</td>
</tr>
<tr>
<td>A</td>
<td>在上方插入一个单元格</td>
</tr>
<tr>
<td>B</td>
<td>在下方插入一个单元格</td>
</tr>
<tr>
<td>M</td>
<td>将Code单元格转换为Markdown单元格</td>
</tr>
<tr>
<td>Y</td>
<td>将Markdown单元格转换为Code单元格</td>
</tr>
<tr>
<td>S</td>
<td>保存并更新记录点文件</td>
</tr>
<tr>
<td>连按两次D</td>
<td>删除选中的单元格</td>
</tr>
<tr>
<td>Z</td>
<td>撤销对单元格的删除</td>
</tr>
<tr>
<td>F</td>
<td>查找并替换</td>
</tr>
<tr>
<td>X</td>
<td>剪切选中的单元格</td>
</tr>
<tr>
<td>C</td>
<td>拷贝选中的单元格</td>
</tr>
<tr>
<td>V</td>
<td>在下方粘贴单元格</td>
</tr>
<tr>
<td>Shift+V</td>
<td>在上方粘贴单元格</td>
</tr>
<tr>
<td>Enter</td>
<td>退出命令模式并进入编辑模式</td>
</tr>
<tr>
<td>Ctrl+Enter</td>
<td>运行选中的单元格</td>
</tr>
<tr>
<td>Shift+Enter</td>
<td>运行选中的单元格，并选中下方的单元格（如果下方没有单元格，则在下方自动插入一个单元格并选中）</td>
</tr>
<tr>
<td>Alt+Enter（Option+Enter）</td>
<td>运行选中的单元格，在下方自动插入一个单元格并选中</td>
</tr>
</tbody></table>
<hr>
<h2 id="扩展插件集nbextensions"><a href="#扩展插件集nbextensions" class="headerlink" title="扩展插件集nbextensions"></a>扩展插件集nbextensions</h2><p>扩展插件集<code>nbextensions</code>包含了一系列非常好用的插件，从而可以大大地扩展Jupyter Notebook的功能，并且增强Jupyter Notebook的交互式体验。</p>
<p>安装过程：</p>
<p><strong>1.安装第三方库jupyter_nbextensions_configurator</strong></p>
<p>它是jupyter notebook扩展插件集的配置器。</p>
<p>pip安装命令：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pip install jupyter_nbextensions_configurator</span><br></pre></td></tr></table></figure>

<p>conda安装命令：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">conda install jupyter_nbextensions_configurator</span><br></pre></td></tr></table></figure>

<p><strong>2.启动配置器</strong></p>
<p>启动命令：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">jupyter nbextensions_configurator enable -<span class="literal">-user</span></span><br></pre></td></tr></table></figure>

<p>此时启动jupyter notebook，会发现菜单多出来一个名为<code>Nbextensions</code>的选项卡。</p>
<p><strong>3.安装第三方库jupyter_contrib_nbextensions</strong></p>
<p>它就是jupyter notebook的扩展插件集。</p>
<p>pip安装命令：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pip install jupyter_contrib_nbextensions</span><br></pre></td></tr></table></figure>

<p>conda安装命令：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">conda install jupyter_contrib_nbextensions</span><br></pre></td></tr></table></figure>

<p><strong>3.安装相关的文件</strong></p>
<p>以便可以通过第2步启用的配置器，对第3步安装的扩展插件集进行访问。</p>
<p>安装命令：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">jupyter contrib nbextension install -<span class="literal">-user</span></span><br></pre></td></tr></table></figure>

<p>此时就会看到，在<code>Nbextensions</code>这个选项卡的配置器中就显示出了很多插件，点一下页面左上方这个小方框，把对勾勾掉，所有的插件都变为可用的了，可以按需使用。</p>
<p><img src="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/%E6%89%A9%E5%B1%95%E6%8F%92%E4%BB%B6.png"></p>
<p>nbextensions中的<strong>常用插件</strong>：</p>
<table>
<thead>
<tr>
<th>插件名</th>
<th>功能</th>
<th>备注</th>
</tr>
</thead>
<tbody><tr>
<td>Hinterland（代码提示）</td>
<td>每输入一个字母，都会弹出代码自动补全的菜单</td>
<td></td>
</tr>
<tr>
<td>Codefolding（代码折叠）</td>
<td>对Code单元格中的代码添加折叠的功能</td>
<td></td>
</tr>
<tr>
<td>Collapsible Headings（可折叠的标题）</td>
<td>根据标题对单元格进行折叠</td>
<td></td>
</tr>
<tr>
<td>Table of Contents（目录表）</td>
<td>将所有的标题显示在一个浮动窗口和一个导航菜单中</td>
<td></td>
</tr>
<tr>
<td>Autopep8（自动pep8）</td>
<td>按照pep8的规范对Code单元格中的Python代码进行格式化</td>
<td>需要安装autopep8这个第三方库。  <strong>pip安装命令</strong>：<code>pip install autopep8</code>  <strong>conda安装命令</strong>：<code>conda install autopep8</code></td>
</tr>
<tr>
<td>Code prettify（代码美化）</td>
<td>格式化Jupyter Notebook支持的所有编程语言的代码</td>
<td>在格式化某种编程语言的代码之前，首先需要安装相应的第三方库或包，要想格式化Python代码，就需要安装yapf这个Google开源的第三方库。  <strong>pip安装命令</strong>：<code>pip install yapf</code>  <strong>conda安装命令</strong>：<code>conda install yapf</code></td>
</tr>
<tr>
<td>Code Font Size（代码字体大小）</td>
<td>在工具栏，提供<strong>增大</strong>以及<strong>减小</strong>代码字体的按钮</td>
<td></td>
</tr>
<tr>
<td>ExecuteTime（执行时间）</td>
<td>在执行的过程中，会显示在什么时刻开始执行；执行结束后，会显示执行时长和在什么时刻结束执行</td>
<td></td>
</tr>
<tr>
<td>AutoSaveTime（自动保存时间）</td>
<td>设置notebook自动保存的时间间隔</td>
<td>notebook被自动保存时，相应的记录点文件不会发生任何变化</td>
</tr>
<tr>
<td>highlighter（高亮显示工具）</td>
<td>对Markdown单元格中的文本进行高亮显示</td>
<td></td>
</tr>
<tr>
<td>Live Markdown Preview（实时Markdown预览）</td>
<td>在Markdown单元格的下方实时预览运行结果</td>
<td></td>
</tr>
<tr>
<td>Tree Filter（文件树过滤器）</td>
<td>在Files选项卡中，只需要输入关键字，就可以对下面的文件和文件夹进行过滤</td>
<td></td>
</tr>
</tbody></table>
<hr>
<h2 id="导出为pdf文件"><a href="#导出为pdf文件" class="headerlink" title="导出为pdf文件"></a>导出为pdf文件</h2><p>这里介绍两种导出为<code>pdf文件</code>的方法：</p>
<p><strong>方法一：</strong>使用菜单导出。</p>
<p>点击<code>File</code>选项卡，选择<code>Download as</code>，选择<code>Markdown(.md)</code>，将文件首先导出为<code>.md</code>格式，再使用<code>Typora</code>打开，并导出为<code>pdf文件</code>。</p>
<p><strong>方法二：</strong>使用命令导出（需要<code>Pandoc</code>和<code>XeLatex</code>支持）。</p>
<p>首先安装<code>Pandoc</code>：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pip install pandoc</span><br></pre></td></tr></table></figure>

<p>安装<code>MikTex</code>：</p>
<p>这里抛出官网链接：<a target="_blank" rel="noopener" href="https://miktex.org/download">https://miktex.org/download</a></p>
<p>安装过程很简单，一路Next，这里不再赘述。（安装之后在cmd测试一下<code>xelatex</code>能否使用）</p>
<p><img src="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/xelatex.png"></p>
<p>点击<code>File</code>选项卡，选择<code>Download as</code>，选择LaTeX(.tex)，将文件首先导出为<code>.tex</code>格式，<strong>为了使导出文件正常显示中文</strong>，打开该文件（本人用的是<code>Sublime Text 3</code>），找到代码<code>\documentclass[11pt]&#123;article&#125;</code>，在其后添加如下代码：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">\usepackage&#123;fontspec, xunicode, xltxtra&#125;</span><br><span class="line">\setmainfont&#123;Microsoft YaHei&#125;</span><br><span class="line">\usepackage&#123;ctex&#125;</span><br></pre></td></tr></table></figure>

<p><img src="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/%E8%A7%A3%E5%86%B3%E4%B8%AD%E6%96%87%E6%98%BE%E7%A4%BA%E9%97%AE%E9%A2%98.png"></p>
<p>进入<code>.tex文件</code>所在目录，打开命令提示符窗口，输入：</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">xelatex yourNotebookName.tex</span><br></pre></td></tr></table></figure>

<p>如果是首次运行，则会安装大量的依赖文件，选择<code>Install</code>即可（过程比较漫长）。</p>
<p><img src="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/%E5%AE%89%E8%A3%85%E4%BE%9D%E8%B5%96.png"></p>
<p>（可以取消勾选弹框，使其自动安装所有需要的依赖）</p>
<p>运行结束后，就会发现在该目录下已经生成了<code>pdf文件</code>。</p>
<p><img src="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/%E7%94%9F%E6%88%90pdf.png"></p>
<p><em>第二种方法生成的pdf文件，要比方法一展示效果更加好。</em></p>
<hr>
<h1 id="结语"><a href="#结语" class="headerlink" title="结语"></a>结语</h1><p>还有很多实用性技巧，暂且现在用不上，就没有总结，以后有时间继续补充。</p>

    </div>

    
    
    
      
  <div class="popular-posts-header">相关文章</div>
  <ul class="popular-posts">
    <li class="popular-posts-item">
      <div class="popular-posts-title"><a href="\next\2021\02\08\Jupyter Notebook\Jupyter Notebook基本配置及使用方法\" rel="bookmark">Jupyter Notebook基本配置及使用方法</a></div>
    </li>
  </ul>


    <footer class="post-footer">
          <div class="reward-container">
  <div></div>
  <button>
    赞赏
  </button>
  <div class="post-reward">
      <div>
        <img src="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/wechat.png" alt="花猪 微信">
        <span>微信</span>
      </div>
      <div>
        <img src="https://cdn.jsdelivr.net/gh/CNhuazhu/Image/alipay.jpg" alt="花猪 支付宝">
        <span>支付宝</span>
      </div>

  </div>
</div>

          <div class="post-tags">
              <a href="/next/tags/Jupyter/" rel="tag"><i class="fa fa-tag"></i> Jupyter</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/next/2021/02/08/Jupyter%20Notebook/Jupyter%20Notebook%E5%9F%BA%E6%9C%AC%E9%85%8D%E7%BD%AE%E5%8F%8A%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95/" rel="prev" title="Jupyter Notebook基本配置及使用方法">
                  <i class="fa fa-chevron-left"></i> Jupyter Notebook基本配置及使用方法
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/next/2021/02/19/%E5%85%B3%E4%BA%8EHexo%E6%B7%BB%E5%8A%A0%E8%B1%86%E7%93%A3%E9%A1%B5%E9%9D%A2%E8%B8%A9%E8%BF%87%E7%9A%84%E5%9D%91/" rel="next" title="关于Hexo添加豆瓣页面踩过的坑">
                  关于Hexo添加豆瓣页面踩过的坑 <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






    <div class="comments"><div id="twikoo-comments"></div></div>
</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">花猪</span>
</div>
<div class="wordcount">
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-line"></i>
    </span>
      <span>站点总字数：</span>
    <span title="站点总字数">356k</span>
  </span>
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
      <span>站点阅读时长 &asymp;</span>
    <span title="站点阅读时长">5:23</span>
  </span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/mist/" rel="noopener" target="_blank">NexT.Mist</a> 强力驱动
  </div>

    </div>
  </footer>

  
  <script src="https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
  <script src="https://cdn.jsdelivr.net/npm/@next-theme/pjax@0.5.0/pjax.min.js" integrity="sha256-3NkoLDrmHLTYj7csHIZSr0MHAFTXth7Ua/DDt4MRUAg=" crossorigin="anonymous"></script>
  <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
  <script src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js" integrity="sha256-yt2kYMy0w8AbtF89WXb2P1rfjcP/HTHLT7097U8Y5b8=" crossorigin="anonymous"></script>
  <script src="https://cdn.jsdelivr.net/npm/medium-zoom@1.0.6/dist/medium-zoom.min.js" integrity="sha256-EdPgYcPk/IIrw7FYeuJQexva49pVRZNmt3LculEr7zM=" crossorigin="anonymous"></script>
<script src="/next/js/comments.js"></script><script src="/next/js/utils.js"></script><script src="/next/js/motion.js"></script><script src="/next/js/schemes/muse.js"></script><script src="/next/js/next-boot.js"></script><script src="/next/js/pjax.js"></script>

  
<script src="/next/js/third-party/search/local-search.js"></script>




  


  <script class="next-config" data-name="leancloud_visitors" type="application/json">{"enable":true,"app_id":"dh8GVAcIwU1TN4zhA5y63iW1-gzGzoHsz","app_key":"hzyAqDKjG4OBGrdPS7mKaOa7","server_url":null,"security":true}</script>
  <script src="/next/js/third-party/statistics/lean-analytics.js"></script>


  

  <script class="next-config" data-name="enableMath" type="application/json">true</script><script class="next-config" data-name="mathjax" type="application/json">{"enable":true,"tags":"none","js":{"url":"https://cdn.jsdelivr.net/npm/mathjax@3.2.0/es5/tex-mml-chtml.js","integrity":"sha256-r+3itOMtGGjap0x+10hu6jW/gZCzxHsoKrOd7gyRSGY="}}</script>
<script src="/next/js/third-party/math/mathjax.js"></script>


<script class="next-config" data-name="twikoo" type="application/json">{"enable":true,"visitor":true,"envId":"hexo-1g41404w9f800e94","el":"#twikoo-comments"}</script>
<script>
document.addEventListener('page:loaded', () => {
  NexT.utils.loadComments(CONFIG.twikoo.el)
    .then(() => NexT.utils.getScript(
      'https://cdn.jsdelivr.net/npm/twikoo/dist/twikoo.all.min.js',
      { condition: window.twikoo }
    ))
    .then(() => {
      twikoo.init(CONFIG.twikoo);
    });
});
</script>

</body>
</html>
